import { Spin } from 'antd';

export interface TableLoadingProps {
  loading: boolean;
}

const TableLoadingWrapStyle: React.CSSProperties = {
  position: 'absolute',
  top: 0,
  left: 0,
  width: '100%',
  height: '100%',
  display: 'flex',
  justifyContent: 'center',
  alignItems: 'center',
  zIndex: 10,
  background: 'rgba(255,255,255,0.5)',
};
const TableLoading = (props: TableLoadingProps) => {
  const { loading } = props;
  if (!loading) return null;
  return (
    <div style={TableLoadingWrapStyle}>
      <Spin spinning={loading}></Spin>
    </div>
  );
};

export default TableLoading;
